import React, {PropTypes, Component} from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import {autobind} from 'core-decorators';
import {observer, inject} from 'mobx-react';
import Store from './store';
import './index.scss';
import MemberItem from "../ateliers/details/membersItem";
import Loading from "../../components/ui/loading";
import EmptyItem from "../../components/emptyItem";


@observer @autobind
export default class Maincmp extends Component {
    static propTypes = {
    };
    constructor(props) {
        super(props);
        this.state = {}
    }
    componentDidMount() {
    }
    render() {
        return (
            <div className="main_body">
                <div className='_list_body clearfix'>
                    {
                        this.store.data.map((item, index) => {
                            return (
                                <MemberItem {...{
                                    store: this.store,
                                    index: index,
                                    key: item.id || index
                                }}/>
                            )
                        })
                    }
                </div>
                {
                    this.store.hasNext ? (
                        <Loading onClick={() => {
                            this.store.getData()
                        }}/>
                    ) : this.store.page == 2 && !this.store.data.length ? (
                        <div>
                            <EmptyItem {...{
                                cls: {
                                    _nfd: true
                                },
                                otherHtml: (
                                    <div className="_otherhtml">
                                        没有查询到成员
                                    </div>
                                )
                            }}/>
                        </div>
                    ) : null
                }
            </div>
        );
    }
}